<template>
  <div id="app" class="container">
    <Category title="电影">
      <!-- 在作用域插槽中必须使用template来接收 -->
      <template scope="obj">
        <ul>
          <li v-for="(item, index) in obj.films" :key="index">
            {{ item }}
          </li>
        </ul>
      </template>
    </Category>

    <Category title="电影">
      <!-- 获取对象的时候通过解构赋值来实现，和上面的一样结果 -->
      <template scope="{films}">
        <ol>
          <li v-for="(item, index) in films" :key="index">
            {{ item }}
          </li>
        </ol>
      </template>
    </Category>

    <Category title="电影">
      <template slot-scope="{films}">
        <h4 v-for="(item, index) in films" :key="index">
          {{ item }}
        </h4>
      </template>
      <ul></ul>
    </Category>
  </div>
</template>

<script>
import Category from "./components/Category.vue";
export default {
  components: { Category },
  name: "App",
  data() {
    return {};
  },
};
</script>
<style>
.container,
.foot {
  display: flex;
  justify-content: space-between;
}
img {
  width: 100%;
}
video {
  width: 100%;
}
h4 {
  text-align: center;
}
</style>

